|
|
|
|
|
|
|
different methods. You would pass the routine the animation name, any text you want spoken, and the location to move the character to. Listing B.1 shows an example of this routine. |
|
|
|
|
|
|
|
|
LISTING B.1. AGENTSUB.TXTUSING A ROUTINE TO CENTRALIZE THE AGENT CALLS. |
|
|
|
 |
|
|
|
|
1: Public Sub Call_Character(PlayAni As String, PlayText As String, x As _
2:Integer, y As Integer)
3: Dim MyRequest As Object
4: If x <> 0 And y <> 0 Then
5: MyAgent.MoveTo x, y
6: End If
7: If PlayAni <> Then
8: MyAgent.Play PlayAni
9: End If
10: If PlayText <> Then
11: Set MyRequest = MyAgent.Speak(PlayText)
12: End If
13: Do Until MyRequest.status = 0
14: DoEvents
15: Loop
16: End Sub |
|
|
|
|
|
|
|
|
You can see in Listing B.1 that it's using the Request object to prevent the application from continuing until the text is completely finished. To move the character to a particular area on the form, use the Left and Top properties to calculate the correct position. |
|
|
|
|
|
|
|
|
When you're finished with the character, use the Hide method to have the character vanish from the screen. In the project, add a text box to the form. When users doubleclick the text box, the character appears near the text box, points to the text box, describes what users should enter into it, and then disappears. To perform this sequence of events, use the code in Listing B.2. Then for each text box, combo box, or any other control, you can use the same method to give users information. |
|
|
|
|
|
|
|
|
LISTING B.2. AGTDEMO.TXTUSING THE AGENT CHARACTER TO TELL USERS WHAT TO TYPE INTO THE TEXT BOX. |
|
|
|
 |
|
|
|
|
1: Private Sub Text1_DblClick()
2: Dim MyRequest As Object
3: MyAgent.MoveTo Text1.Left / 15 + frmAgent.Left / 15 + Text1.Width _
4: / 15, frmAgent.Top / 15 + Text1.Top / 15 + Text1.Height / 15
|
|
|
|
|
|